//
//  CaseCell.m
//  UI_HLJ_Frame
//
//  Created by dllo on 15/7/1.
//  Copyright (c) 2015年 毕宏伟. All rights reserved.
//

#import "CaseCell.h"
#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height
@implementation CaseCell

- (void)dealloc
{
    [_caseImageView release];
    [_caseBackGroundView release];
    [_caseCollect release];
    [_caseName release];
    [_caseTitle release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.caseBackGroundView = [[UIView alloc] init];
        [self.contentView addSubview:self.caseBackGroundView];
        [self.caseBackGroundView release];
        
        // 图片
        self.caseImageView = [[UIImageView alloc] init];
        [self.caseBackGroundView addSubview:self.caseImageView];
        [self.caseImageView release];
        
        // 标题
        self.caseTitle = [[UILabel alloc] init];
        [self.caseBackGroundView addSubview:self.caseTitle];
        [self.caseTitle release];
        
        // 商家
        self.caseName = [[UILabel alloc] init];
        [self.caseBackGroundView addSubview:self.caseName];
        self.caseName.font = [UIFont systemFontOfSize:14];
        [self.caseName release];
        
        // 收藏
        self.caseCollect = [[UILabel alloc] init];
        [self.caseBackGroundView addSubview:self.caseCollect];
        [self.caseName release];
    }
    return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    self.caseBackGroundView.frame = CGRectMake(0, 0, WIDTH, HEIGHT);
    self.caseBackGroundView.clipsToBounds = YES;
    
    self.caseImageView.frame = CGRectMake(5, 0, WIDTH-10, HEIGHT/1.3);
    
    self.caseTitle.frame = CGRectMake(10, HEIGHT/1.3, WIDTH/3*2, 25);
//        self.caseTitle.backgroundColor = [UIColor redColor];
    
    self.caseName.frame = CGRectMake(10, HEIGHT/1.1, WIDTH/3*2, 20);
    //    self.caseName.backgroundColor = [UIColor redColor];
    
    self.caseCollect.frame = CGRectMake(WIDTH/6*5, HEIGHT/1.2, WIDTH/6, 30);
//        self.caseCollect.backgroundColor = [UIColor orangeColor];
}








- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
